<?php

namespace App\Http\Requests\Admin\v1;

use Illuminate\Foundation\Http\FormRequest;
use App\Http\Requests\ApiRequest;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Rules\In;
use App\Services\EasySms\AliSMSCountry;

class CustomerLoginRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    // public function authorize()
    // {
    //     return false;
    // }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $dial_codes = array_column(AliSMSCountry::codeMap(), 'dial_code');
        $rules = [
            'phone' => ['required', 'string'],
            'area_code' => ['required', 'string',Rule::in($dial_codes)],
            'verify_code' => ['required', 'string', 'size:6'],
        ];
        return $rules;
    }
}
